package com.ym521.sadcrash.core

import android.app.Activity
import android.app.Application
import android.os.Bundle
import android.util.Log

/**
 *@author Ym
 *E-mail: 2435970206@qq.com
 *createTime:2023/6/11
 *explain:
 * activity的管理
 */
internal class ActivityManager : Application.ActivityLifecycleCallbacks {
    private val TAG = "ActivityManager"
    var currentActivity: Activity? = null

    override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
        Log.v(TAG,"onActivityCreated  ${activity.hashCode()}")
        this.currentActivity = activity
    }

    override fun onActivityStarted(activity: Activity) {
        Log.v(TAG,"onActivityStarted  ${activity.hashCode()}")
        this.currentActivity = activity
    }
    override fun onActivityResumed(activity: Activity) {
        Log.v(TAG,"onActivityResumed  ${activity.hashCode()}")
        this.currentActivity = activity
    }
    override fun onActivityPaused(activity: Activity) {
        Log.v(TAG,"onActivityPaused  ${activity.hashCode()}")
    }
    override fun onActivityStopped(activity: Activity) {
        Log.v(TAG,"onActivityStopped  ${activity.hashCode()}")
    }
    override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {
        Log.v(TAG,"onActivitySaveInstanceState  ${activity.hashCode()}")
    }
    override fun onActivityDestroyed(activity: Activity) {
        Log.v(TAG,"onActivityDestroyed  ${activity.hashCode()}")
    }


}